using System.Data.Entity.ModelConfiguration;

namespace Spotshub.Plugin.Payments.GlobalPayments
{
    public partial class CreditCardMap : EntityTypeConfiguration<PaymentCreditCard>
    {
        public CreditCardMap()
        {
            this.ToTable("GlobalPaymentsCreditCard");
            this.HasKey(x => x.Id);

            this.HasRequired(x => x.PaymentProfile)
                .WithMany(x => x.CreditCards);

            this.Property(x => x.RawResult);
        }
    }

    public partial class ProfileMap : EntityTypeConfiguration<PaymentProfile>
    {
        public ProfileMap()
        {
            this.ToTable("GlobalPaymentsProfile");
            this.HasKey(x => x.Id);
        }
    }

    public partial class TransactionMap : EntityTypeConfiguration<PaymentTransaction>
    {
        public TransactionMap()
        {
            this.ToTable("GlobalPaymentsTransaction");
            this.HasKey(x => x.Id);

            this.Ignore(x => x.PaymentStatus);

            this.Property(i => i.UId).IsOptional();
        }
    }
}